package com.chexiehui.jc.mvp.home;

import com.chexiehui.jc.Constants;
import com.chexiehui.jc.base.BaseModel;
import com.chexiehui.jc.base.BasePage;
import com.chexiehui.jc.base.BaseView;
import com.chexiehui.jc.entity.CarSeriesInfo;
import com.chexiehui.jc.entity.ForumInfo;
import com.chexiehui.jc.entity.PostInfo;
import com.chexiehui.jc.entity.UserInfo;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @Description 搜索综合
 * @Auth SongJun
 * @Date 2019/11/20 10:05
 **/
public interface SearchResultAllCovenant {

    interface View extends BaseView {
        void onGetUserListSuccess(BaseModel<BasePage<UserInfo>> successResult);

        void onGetUserListFailure(BaseModel<Object> failureResult);

        void onGetPostListSuccess(BaseModel<BasePage<PostInfo>> successResult);

        void onGetPostListFailure(BaseModel<Object> failureResult);

        void onGetForumListSuccess(BaseModel<BasePage<ForumInfo>> successResult);

        void onGetForumListFailure(BaseModel<Object> failureResult);

        void onGetSeriesListSuccess(BaseModel<BasePage<CarSeriesInfo>> successResult);

        void onGetSeriesListFailure(BaseModel<Object> failureResult);

        void onDoDianZanSuccess(BaseModel<String> successResult);

        void onDoDianZanFailure(BaseModel<Object> failureResult);

        void onDoFollowPersonSuccess(BaseModel<String> successResult);

        void onDoFollowPersonFailure(BaseModel<Object> failureResult);

        void onDoFollowSeriesSuccess(BaseModel<String> successResult);
        void onDoFollowSeriesFailure(BaseModel<Object> failureResult);

        String getKeyword();

    }

    interface Stores {
        @FormUrlEncoded
        @POST(Constants.URL_SEARCH_USER_LIST)
        Observable<BaseModel<BasePage<UserInfo>>> getUserList(
                @Field("key") String key,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize);

        @FormUrlEncoded
        @POST(Constants.URL_GET_POSTS_LIST)
        Observable<BaseModel<BasePage<PostInfo>>> getPostList(
                @Field("key") String key,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize);

        @FormUrlEncoded
        @POST(Constants.URL_SEARCH_FORUM_LIST)
        Observable<BaseModel<BasePage<ForumInfo>>> getForumList(
                @Field("key") String key,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize);

        @FormUrlEncoded
        @POST(Constants.URL_SEARCH_SERIES_LIST)
        Observable<BaseModel<BasePage<CarSeriesInfo>>> getSeriesList(
                @Field("key") String key,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize);

        @FormUrlEncoded
        @POST(Constants.URL_POST_DIAN_ZAN)
        Observable<BaseModel<String>> doDianZan(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

        @FormUrlEncoded
        @POST(Constants.URL_ADD_FOLLOW)
        Observable<BaseModel<String>> doFollowPerson(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

        @FormUrlEncoded
        @POST(Constants.URL_ADD_FOLLOW)
        Observable<BaseModel<String>> doFollowSeries(
                @Field("orgid") String orgid,
                @Field("type") String type
        );
    }

    interface Presenter {
        void getUserList();
        void getPostList();
        void getForumList();
        void getSeriesList();

        void doDianZan(String objId);
        void doFollowPerson(String objId);
        void doFollowSeries(String objId);
    }

}